package gui.mainWindow;

import gui.finalsOptions.FinalsOptionsWindow;
import gui.mainWindow.finals.FinalsActionListener;
import gui.mainWindow.finals.FinalsController;
import gui.mainWindow.finals.FinalsMouseListener;
import gui.mainWindow.finals.FinalsTableModelRenderer;
import gui.mainWindow.ranking.RankingController;
import gui.mainWindow.ranking.RankingPanel;
import gui.mainWindow.scores.ScoresActionListener;
import gui.mainWindow.scores.ScoresController;
import gui.mainWindow.scores.ScoresKeyListener;
import gui.mainWindow.scores.ScoresMouseListener;
import gui.mainWindow.scores.ScoresTableModelRenderer;
import gui.mainWindow.targetAssignment.TargetAssignmentController;
import gui.mainWindow.targetAssignment.TargetAssignmentKeyListener;
import gui.mainWindow.targetAssignment.TargetAssignmentMouseListener;
import gui.mainWindow.targetAssignment.TargetCharDropDownRenderer;
import gui.mainWindow.targetAssignment.TargetNumberDropDownRenderer;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.LayoutStyle;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;

import print.Printer;
import table.models.ParticipantsTableModel;
import table.models.ParticipantsTableModelRenderer;
import table.models.RankingTable;
import table.models.StatisticsTableModel;
import table.models.TableWithOverwrite;
import tournamentData.TournamentData;

import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;

import core.AutoSaver;
import core.CustomIcons;
import core.GuiComponentLabels;
import dataBase.DbHolder;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class MainWindow extends javax.swing.JFrame {
	private JMenuBar menuBar;
	private JTextField refereeTextBox;
	private JTextField tournamentLeadTextBox;
	private JTextField organizerTextBox;
	private JTextField endDateTextBox;
	private JTextField startDateTextBox;
	private JComboBox tournamentTypeDropDown;
	private JMenuItem openMenuItem;
	private JMenuItem addPlayerMenuIten;
	private JMenuItem newTournamentMenuItem;
	private JMenuItem archerEditingMenuItem;
	private JMenuItem colorCustomizingMenuItem;
	private JMenuItem importFromCsvMenuItem;
	private JMenu importMenu;
	private JFrame tournamentInformationFrame;
	private JTextField tournamentNameTextBox;
	private JPanel tournamentInformation;
	private JSplitPane mainSplitPane;
	private JComboBox scoresTargetCharDropDown;
	private JComboBox scoresTargetNumberDropDown;
	private JLabel scoresParticipantAgeClassLabel;
	private JLabel scoresParticipantBowCathegoryLabel;
	private JLabel scoresParticipantClubLabel;
	private JComboBox scoresParticipantNameDropDown;
	private TableWithOverwrite scoresTable;
	private JPanel participantContainer;
	private JPanel targetContainer;
	private JPanel scoresTab;
	private JScrollPane jScrollPane1;
	private JButton incrementPlayersPerTargetButton;
	private JLabel playersPerTargetLabel;
	private JButton decrementPlayersPerTargetButton;
	private JPanel playersPerTargetContainer;
	private JButton incrementNumberOfTargetsButton;
	private JScrollPane participantsScrollPane;
	private JScrollPane nonParticipantsScrollPane;
	private JTable nonParticipantsTable;
	private JTable participantsTable;
	private JSplitPane playerAssignmentTab;
	private JLabel imageLabel;
	private JPanel participantsTab;
	private JTabbedPane mainTabPane;
	private JMenuItem CloseMenuItem;
	private JMenu optionsMenu;
	private JMenu editMenu;
	private JMenu dataMenu;

	private final MainWindowController controller;
	private final TargetAssignmentController targetAssignmentController;
	private final ScoresController scoresController;
	private JMenuItem printTargetAssignentMenuItem;
	private JMenuItem printParticipantsMenuItem;
	private JMenu printMenu;
	private JPanel koPanel;
	private JButton startFinalForBowCathegoryButton;
	private JScrollPane jScrollPane3;
	private JTable finalsParticipantsTable;
	private JComboBox finalsBowCathegoryDropDown;
	private JPanel finalsChosingPanel;
	private JSplitPane finalsTab;
	private JPanel finalsPanel;
	private JMenuItem finalsPermissionMenuItem;
	private JCheckBox autoSaveCheckBox;
	private JCheckBox saveAnyEntryCheckBox;
	private JPanel scoresTabOptionsWrapperPanel;
	private JButton resetAssignmentsButton;
	private JScrollPane jScrollPane4;
	private JTable statisticsTable;
	private JMenuItem printRankingMenuItem;
	private JScrollPane rankingWrapperScrollPane;
	private RankingPanel rankingWrapper;
	private JPanel rankingTab;
	private JScrollPane jScrollPane2;
	private final File file;
	private final MainWindowMouseListener mouseListener;
	private final FinalsMouseListener finalsMouseListener;
	private final TargetAssignmentMouseListener targetAssignmentMouseListener;
	private final TargetAssignmentKeyListener targetAssignmentKeyListener;
	private final ScoresActionListener scoresActionListener;
	private final ScoresKeyListener scoresKeyListener;
	private final ScoresMouseListener scoresMouseListener;
	private final RankingController rankingController;
	private final FinalsActionListener finalsActionListener;
	private JLabel numberOfTargetsLabel;
	private JButton decrementNumberOfTargetsButton;
	private JPanel numberOfTargetsContainer;
	private JButton removeAssignmentButton;
	private JButton assignPlayerButton;
	private JComboBox targetCharDropDown;
	private JComboBox targetNumberDropDown;
	private JTable targetAssignmentTable;
	private JPanel assignmentContainer;
	private JPanel targetAssignmentTab;
	private final FinalsController finalsController;
	private JMenuItem saveItem;
	private JMenuItem customizeTournamentItem;
	private final MainWindowKeyListener keyListener;
	private ArrayList < JPanel > rankingPanels;
	private ArrayList < RankingTable > rankingTables;
	private mxGraph graph;
	private mxGraphComponent graphComponent;

	/**
	 * Auto-generated main method to display this JFrame
	 */
	public static void main(String [] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MainWindow inst = new MainWindow(new File("TEST_15.03.2011.xml"));
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}

	public MainWindow(File file) {
		this.setIconImage(CustomIcons.iconImage);
		this.file = file;
		this.controller = new MainWindowController(this);
		this.targetAssignmentController = new TargetAssignmentController(this);
		this.scoresController = new ScoresController(this);
		this.scoresKeyListener = new ScoresKeyListener(this);
		this.scoresMouseListener = new ScoresMouseListener(this);
		this.finalsMouseListener = new FinalsMouseListener(this);
		this.scoresActionListener = new ScoresActionListener(this);
		this.mouseListener = new MainWindowMouseListener();
		this.keyListener = new MainWindowKeyListener();
		this.targetAssignmentMouseListener = new TargetAssignmentMouseListener(this);
		this.targetAssignmentKeyListener = new TargetAssignmentKeyListener(this);
		this.rankingController = new RankingController(this);
		this.finalsController = new FinalsController(this);
		this.finalsActionListener = new FinalsActionListener(this);
		this.initGUI();
		TournamentData.getInstance().addObserver(this.controller);
		this.controller.setGeneralTournamentInformation();
		this.controller.setShownTournamentInformation();
		try {
			this.scoresController.buildScoresTable();
		} catch (SQLException e1) {
			e1.printStackTrace();
		}
		try {
			this.controller.setExtendedTournnamentInformation();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	private void initGUI() {
		try {
			GridLayout thisLayout = new GridLayout(1, 1);
			thisLayout.setHgap(5);
			thisLayout.setVgap(5);
			thisLayout.setColumns(1);
			this.getContentPane().setLayout(thisLayout);
			this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				this.mainSplitPane = new JSplitPane();
				this.mainSplitPane.setOneTouchExpandable(true);
				this.mainSplitPane.setDividerLocation(Integer.MAX_VALUE);
				this.getContentPane().add(this.mainSplitPane);
				{
					this.tournamentInformation = new JPanel();
					this.mainSplitPane.add(this.tournamentInformation, JSplitPane.RIGHT);
					GroupLayout tournamentInformationLayout = new GroupLayout(this.tournamentInformation);
					this.tournamentInformation.setLayout(tournamentInformationLayout);
					{

						ComboBoxModel tournamentTypeDropDownModel = new DefaultComboBoxModel(DbHolder.getInstance().getArcherData().getAllTournamentTypes());
						this.tournamentTypeDropDown = new JComboBox();
						this.tournamentTypeDropDown.setModel(tournamentTypeDropDownModel);
					}
					{
						this.tournamentNameTextBox = new JTextField();
						this.tournamentNameTextBox.setText(GuiComponentLabels.TOURNAMENT_NAME);
					}
					{
						this.startDateTextBox = new JTextField();
						this.startDateTextBox.setText(GuiComponentLabels.START_DATE);
					}
					{
						this.endDateTextBox = new JTextField();
						this.endDateTextBox.setText(GuiComponentLabels.END_DATE);
					}
					{
						this.organizerTextBox = new JTextField();
						this.organizerTextBox.setText(GuiComponentLabels.ORGANIZER);
					}
					{
						this.tournamentLeadTextBox = new JTextField();
						this.tournamentLeadTextBox.setText(GuiComponentLabels.TOURNAMENT_LEAD);
					}
					{
						this.refereeTextBox = new JTextField();
						this.refereeTextBox.setText(GuiComponentLabels.REFEREE);
					}
					{
						this.imageLabel = new JLabel(null, CustomIcons.logo, JLabel.RIGHT);
						this.imageLabel.setBackground(new java.awt.Color(255, 255, 255));
						this.imageLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					}
					{
						this.jScrollPane4 = new JScrollPane();
						{
							StatisticsTableModel statisticsTableModel = new StatisticsTableModel();
							this.statisticsTable = new JTable();
							this.jScrollPane4.setViewportView(this.getStatisticsTable());
							this.statisticsTable.setModel(statisticsTableModel);
							this.statisticsTable.setEnabled(false);
							this.statisticsTable.setShowHorizontalLines(false);
							this.statisticsTable.setShowVerticalLines(false);
							this.statisticsTable.setFocusable(false);
							this.statisticsTable.getColumnModel().getColumn(0).setPreferredWidth(40);
						}
					}
					{
						this.autoSaveCheckBox = new JCheckBox();
						this.autoSaveCheckBox.setText(GuiComponentLabels.AUTOSAVE);
						this.autoSaveCheckBox.setSelected(true);
						AutoSaver.getInstance().setAutoUpdate(true);
						this.autoSaveCheckBox.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								AutoSaver.getInstance().setAutoUpdate(MainWindow.this.autoSaveCheckBox.isSelected());
							}
						});
					}

					tournamentInformationLayout.setVerticalGroup(tournamentInformationLayout.createSequentialGroup().addContainerGap(12, 12)
							.addComponent(this.tournamentTypeDropDown, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.tournamentNameTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.startDateTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.endDateTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.organizerTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.tournamentLeadTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.refereeTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
							.addComponent(this.autoSaveCheckBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGap(9)
							.addComponent(this.jScrollPane4, GroupLayout.PREFERRED_SIZE, 243, GroupLayout.PREFERRED_SIZE).addGap(12)
							.addComponent(this.imageLabel, GroupLayout.PREFERRED_SIZE, 132, GroupLayout.PREFERRED_SIZE).addContainerGap(12, 12));
					tournamentInformationLayout.setHorizontalGroup(tournamentInformationLayout
							.createSequentialGroup()
							.addContainerGap(7, 7)
							.addGroup(
									tournamentInformationLayout.createParallelGroup()
											.addComponent(this.autoSaveCheckBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.refereeTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.tournamentLeadTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.organizerTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.endDateTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.startDateTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.tournamentNameTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.tournamentTypeDropDown, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.imageLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
											.addComponent(this.jScrollPane4, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)).addContainerGap(12, 12));
				}
				{
					this.mainTabPane = new JTabbedPane();
					this.mainSplitPane.add(this.mainTabPane, JSplitPane.LEFT);
					{
						this.playerAssignmentTab = new JSplitPane();
						this.playerAssignmentTab.setOrientation(JSplitPane.VERTICAL_SPLIT);

						this.playerAssignmentTab.setDividerLocation(200);
						this.mainTabPane.addTab("Spieler", null, this.playerAssignmentTab, null);
						{
							this.nonParticipantsScrollPane = new JScrollPane();
							this.playerAssignmentTab.add(this.nonParticipantsScrollPane, JSplitPane.LEFT);
							this.nonParticipantsScrollPane.setPreferredSize(new java.awt.Dimension(692, 0));
							{
								this.nonParticipantsTable = new JTable();
								this.nonParticipantsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
								this.nonParticipantsScrollPane.setViewportView(this.nonParticipantsTable);
								this.nonParticipantsTable.setModel(new ParticipantsTableModel(new String [] { GuiComponentLabels.ID, GuiComponentLabels.NAME, GuiComponentLabels.SURNAME,
										GuiComponentLabels.NATION, GuiComponentLabels.COUNTRY, GuiComponentLabels.BOW_CATHEGORY, GuiComponentLabels.AGE_CLASS, GuiComponentLabels.CLUB,
										GuiComponentLabels.GENDER, GuiComponentLabels.LICENSE, GuiComponentLabels.COUNTRY_RATING, GuiComponentLabels.BIRTHDATE }));
								this.nonParticipantsTable.setAutoCreateRowSorter(true);
								this.nonParticipantsTable.setDefaultRenderer(Object.class, new ParticipantsTableModelRenderer());
								this.nonParticipantsTable.setDefaultRenderer(Integer.class, new ParticipantsTableModelRenderer());
								this.nonParticipantsTable.setDefaultRenderer(Boolean.class, new ParticipantsTableModelRenderer());
								this.nonParticipantsTable.addKeyListener(this.keyListener);
								this.nonParticipantsTable.addMouseListener(this.mouseListener);
								this.setColumnwidths(this.nonParticipantsTable);
								this.controller.buildNonParticipantsTable();
							}
						}
						{
							this.participantsScrollPane = new JScrollPane();
							this.playerAssignmentTab.add(this.participantsScrollPane, JSplitPane.RIGHT);
							this.participantsScrollPane.setPreferredSize(new java.awt.Dimension(692, 631));
							{
								this.participantsTable = new JTable();
								this.participantsScrollPane.setViewportView(this.participantsTable);
								this.participantsTable.setModel(new ParticipantsTableModel(new String [] { GuiComponentLabels.ID, GuiComponentLabels.NAME, GuiComponentLabels.SURNAME,
										GuiComponentLabels.NATION, GuiComponentLabels.COUNTRY, GuiComponentLabels.BOW_CATHEGORY, GuiComponentLabels.AGE_CLASS, GuiComponentLabels.CLUB,
										GuiComponentLabels.GENDER, GuiComponentLabels.LICENSE, GuiComponentLabels.COUNTRY_RATING, GuiComponentLabels.BIRTHDATE }));
								this.participantsTable.addMouseListener(this.mouseListener);
								this.participantsTable.addKeyListener(this.keyListener);
								this.participantsTable.setAutoCreateRowSorter(true);
								this.participantsTable.setDefaultRenderer(Object.class, new ParticipantsTableModelRenderer());
								this.participantsTable.setDefaultRenderer(Integer.class, new ParticipantsTableModelRenderer());
								this.participantsTable.setDefaultRenderer(Boolean.class, new ParticipantsTableModelRenderer());
								this.participantsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
								this.setColumnwidths(this.participantsTable);
								this.controller.buildParticipantsTable();
							}
						}
					}
					{
						this.targetAssignmentTab = new JPanel();
						this.mainTabPane.addTab(GuiComponentLabels.TARGET_ASSIGNMENT, null, this.targetAssignmentTab, null);
						GroupLayout targetAssignmentTabLayout = new GroupLayout(this.targetAssignmentTab);
						this.targetAssignmentTab.setLayout(targetAssignmentTabLayout);
						this.targetAssignmentTab.setPreferredSize(new java.awt.Dimension(694, 666));
						{
							this.assignmentContainer = new JPanel();
							GroupLayout assignmentContainerLayout = new GroupLayout(this.assignmentContainer);
							this.assignmentContainer.setLayout(assignmentContainerLayout);
							this.assignmentContainer.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
							{
								this.targetNumberDropDown = new JComboBox();
								this.targetNumberDropDown.setRenderer(new TargetNumberDropDownRenderer());
								this.targetNumberDropDown.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent evt) {
										MainWindow.this.targetCharDropDown.repaint();
									}
								});
							}
							{
								this.targetCharDropDown = new JComboBox();
								this.targetCharDropDown.setRenderer(new TargetCharDropDownRenderer(this));
								this.targetCharDropDown.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent evt) {
										MainWindow.this.targetNumberDropDown.repaint();
									}
								});
							}
							{
								this.numberOfTargetsContainer = new JPanel();
								GroupLayout numberOfTargetsContainerLayout = new GroupLayout(this.numberOfTargetsContainer);
								this.numberOfTargetsContainer.setLayout(numberOfTargetsContainerLayout);
								this.numberOfTargetsContainer.setBorder(BorderFactory.createTitledBorder(GuiComponentLabels.NUMBER_OF_TARGETS));
								{
									this.decrementNumberOfTargetsButton = new JButton();
									this.decrementNumberOfTargetsButton.setText(" ");
									this.decrementNumberOfTargetsButton.setIcon(CustomIcons.remove);
									this.decrementNumberOfTargetsButton.addActionListener(new ActionListener() {
										public void actionPerformed(ActionEvent evt) {
											MainWindow.this.targetAssignmentController.decrementNumberOfTargets();
										}
									});

								}
								{
									this.numberOfTargetsLabel = new JLabel();
									this.numberOfTargetsLabel.setText("0");
									this.numberOfTargetsLabel.setFont(new java.awt.Font("Bitstream Charter", 1, 16));
									this.numberOfTargetsLabel.setAlignmentY(0.0f);
									this.numberOfTargetsLabel.setHorizontalAlignment(SwingConstants.CENTER);
								}
								{
									this.incrementNumberOfTargetsButton = new JButton();
									this.incrementNumberOfTargetsButton.setText(" ");
									this.incrementNumberOfTargetsButton.setIcon(CustomIcons.add);
									this.incrementNumberOfTargetsButton.addActionListener(new ActionListener() {
										public void actionPerformed(ActionEvent evt) {
											MainWindow.this.targetAssignmentController.incrementNumberOfTargets();
										}
									});

								}
								numberOfTargetsContainerLayout.setHorizontalGroup(numberOfTargetsContainerLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												numberOfTargetsContainerLayout.createParallelGroup()
														.addComponent(this.decrementNumberOfTargetsButton, GroupLayout.Alignment.LEADING, 0, 151, Short.MAX_VALUE)
														.addComponent(this.numberOfTargetsLabel, GroupLayout.Alignment.LEADING, 0, 150, Short.MAX_VALUE)
														.addComponent(this.incrementNumberOfTargetsButton, GroupLayout.Alignment.LEADING, 0, 151, Short.MAX_VALUE)).addContainerGap());
								numberOfTargetsContainerLayout.setVerticalGroup(numberOfTargetsContainerLayout.createSequentialGroup()
										.addComponent(this.incrementNumberOfTargetsButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.numberOfTargetsLabel, 0, 40, Short.MAX_VALUE)
										.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.decrementNumberOfTargetsButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap());
							}
							{
								this.resetAssignmentsButton = new JButton();
								this.resetAssignmentsButton.setText(GuiComponentLabels.RESET_BUTTON);
								this.resetAssignmentsButton.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent evt) {
										MainWindow.this.targetAssignmentController.resetAllAssignments();
									}
								});
							}
							{
								this.playersPerTargetContainer = new JPanel();
								GroupLayout jPanel1Layout = new GroupLayout(this.playersPerTargetContainer);
								this.playersPerTargetContainer.setBorder(BorderFactory.createTitledBorder(GuiComponentLabels.PLAYERS_PER_TARGET));
								this.playersPerTargetContainer.setLayout(jPanel1Layout);
								{
									this.decrementPlayersPerTargetButton = new JButton();
									this.decrementPlayersPerTargetButton.setText(" ");
									this.decrementPlayersPerTargetButton.setIcon(CustomIcons.remove);
									this.decrementPlayersPerTargetButton.addActionListener(new ActionListener() {
										public void actionPerformed(ActionEvent evt) {
											MainWindow.this.targetAssignmentController.decrementPlayersPerTarget();
										}
									});
								}
								{
									this.playersPerTargetLabel = new JLabel();
									this.playersPerTargetLabel.setText("0");
									this.playersPerTargetLabel.setHorizontalAlignment(SwingConstants.CENTER);
									this.playersPerTargetLabel.setFont(new java.awt.Font("Bitstream Charter", 1, 16));
									this.playersPerTargetLabel.setAlignmentY(0.0f);
								}
								{
									this.incrementPlayersPerTargetButton = new JButton();
									this.incrementPlayersPerTargetButton.setText(" ");
									this.incrementPlayersPerTargetButton.setIcon(CustomIcons.add);
									this.incrementPlayersPerTargetButton.addActionListener(new ActionListener() {
										public void actionPerformed(ActionEvent evt) {
											MainWindow.this.targetAssignmentController.incrementPlayersPerTarget();
										}
									});
								}
								jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup()
										.addComponent(this.incrementPlayersPerTargetButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.playersPerTargetLabel, 0, 40, Short.MAX_VALUE)
										.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.decrementPlayersPerTargetButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap());
								jPanel1Layout.setHorizontalGroup(jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout.createParallelGroup().addComponent(this.decrementPlayersPerTargetButton, GroupLayout.Alignment.LEADING, 0, 151, Short.MAX_VALUE)
														.addComponent(this.playersPerTargetLabel, GroupLayout.Alignment.LEADING, 0, 150, Short.MAX_VALUE)
														.addComponent(this.incrementPlayersPerTargetButton, GroupLayout.Alignment.LEADING, 0, 151, Short.MAX_VALUE)).addContainerGap());
							}
							{
								this.removeAssignmentButton = new JButton();
								this.removeAssignmentButton.setText(GuiComponentLabels.DELETE_ASSIGNMENT_BUTTON);
								this.removeAssignmentButton.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent evt) {
										MainWindow.this.targetAssignmentController.removeSelectedAssignment();
									}
								});
							}
							{
								this.assignPlayerButton = new JButton();
								this.assignPlayerButton.setText(GuiComponentLabels.ASSIGN_TARGET_BUTTON);
								this.assignPlayerButton.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent evt) {
										MainWindow.this.targetAssignmentController.assignPlayer();

									}
								});
							}
							assignmentContainerLayout.setHorizontalGroup(assignmentContainerLayout
									.createSequentialGroup()
									.addContainerGap()
									.addGroup(
											assignmentContainerLayout
													.createParallelGroup()
													.addGroup(
															GroupLayout.Alignment.LEADING,
															assignmentContainerLayout.createSequentialGroup()
																	.addComponent(this.targetNumberDropDown, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)
																	.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.targetCharDropDown, 0, 56, Short.MAX_VALUE))
													.addComponent(this.removeAssignmentButton, GroupLayout.Alignment.LEADING, 0, 129, Short.MAX_VALUE)
													.addComponent(this.assignPlayerButton, GroupLayout.Alignment.LEADING, 0, 129, Short.MAX_VALUE)
													.addComponent(this.playersPerTargetContainer, GroupLayout.Alignment.LEADING, 0, 129, Short.MAX_VALUE)
													.addComponent(this.numberOfTargetsContainer, GroupLayout.Alignment.LEADING, 0, 129, Short.MAX_VALUE)
													.addGroup(
															assignmentContainerLayout.createSequentialGroup()
																	.addComponent(this.resetAssignmentsButton, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)
																	.addGap(0, 0, Short.MAX_VALUE))).addContainerGap());
							assignmentContainerLayout.setVerticalGroup(assignmentContainerLayout
									.createSequentialGroup()
									.addContainerGap()
									.addGroup(
											assignmentContainerLayout
													.createParallelGroup()
													.addComponent(this.targetNumberDropDown, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE)
													.addComponent(this.targetCharDropDown, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
									.addComponent(this.assignPlayerButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.removeAssignmentButton, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.resetAssignmentsButton, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
									.addGap(0, 200, Short.MAX_VALUE).addComponent(this.numberOfTargetsContainer, GroupLayout.PREFERRED_SIZE, 137, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
									.addComponent(this.playersPerTargetContainer, GroupLayout.PREFERRED_SIZE, 137, GroupLayout.PREFERRED_SIZE).addContainerGap());
						}
						{
							this.jScrollPane1 = new JScrollPane();
							{
								this.targetAssignmentTable = new JTable();
								String [] title = new String [] { GuiComponentLabels.ID, GuiComponentLabels.TARGETNUMBER, GuiComponentLabels.NAME, GuiComponentLabels.SURNAME, GuiComponentLabels.CLUB,
										GuiComponentLabels.BOW_CATHEGORY, GuiComponentLabels.AGE_CLASS, GuiComponentLabels.GENDER };
								ParticipantsTableModel model = new ParticipantsTableModel(title, 5, 6, 7);

								this.targetAssignmentTable.setModel(model);
								this.targetAssignmentTable.setDefaultRenderer(Object.class, new ParticipantsTableModelRenderer());
								this.targetAssignmentTable.setDefaultRenderer(Integer.class, new ParticipantsTableModelRenderer());
								this.targetAssignmentTable.setDefaultRenderer(Boolean.class, new ParticipantsTableModelRenderer());
								this.targetAssignmentTable.addMouseListener(this.targetAssignmentMouseListener);
								this.targetAssignmentTable.addKeyListener(this.targetAssignmentKeyListener);
								this.targetAssignmentTable.setAutoCreateRowSorter(true);
								this.setColumnwidths2(this.targetAssignmentTable);
								this.targetAssignmentTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
								this.jScrollPane1.setViewportView(this.targetAssignmentTable);
							}
						}
						targetAssignmentTabLayout.setHorizontalGroup(targetAssignmentTabLayout.createSequentialGroup().addContainerGap()
								.addComponent(this.assignmentContainer, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
								.addComponent(this.jScrollPane1, 0, 503, Short.MAX_VALUE).addContainerGap());
						targetAssignmentTabLayout.setVerticalGroup(targetAssignmentTabLayout
								.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										targetAssignmentTabLayout.createParallelGroup().addComponent(this.assignmentContainer, GroupLayout.Alignment.LEADING, 0, 631, Short.MAX_VALUE)
												.addComponent(this.jScrollPane1, GroupLayout.Alignment.LEADING, 0, 632, Short.MAX_VALUE)).addContainerGap());
					}
					{
						this.scoresTab = new JPanel();
						GroupLayout scoresTabLayout = new GroupLayout(this.scoresTab);
						this.scoresTab.setLayout(scoresTabLayout);
						this.mainTabPane.addTab(GuiComponentLabels.SCORES, null, this.scoresTab, null);
						{
							this.targetContainer = new JPanel();
							GroupLayout targetContainerLayout = new GroupLayout(this.targetContainer);
							this.targetContainer.setLayout(targetContainerLayout);
							this.targetContainer.setBorder(BorderFactory.createTitledBorder(GuiComponentLabels.TARGETNUMBER));
							{
								this.scoresTargetNumberDropDown = new JComboBox();
								this.scoresTargetNumberDropDown.addActionListener(this.scoresActionListener);
							}
							{
								this.scoresTargetCharDropDown = new JComboBox();
								this.scoresTargetCharDropDown.addActionListener(this.scoresActionListener);
							}
							targetContainerLayout.setHorizontalGroup(targetContainerLayout.createSequentialGroup().addContainerGap()
									.addComponent(this.scoresTargetNumberDropDown, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE).addGap(0, 47, Short.MAX_VALUE)
									.addComponent(this.scoresTargetCharDropDown, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE).addContainerGap());
							targetContainerLayout.setVerticalGroup(targetContainerLayout
									.createSequentialGroup()
									.addGroup(
											targetContainerLayout
													.createParallelGroup(GroupLayout.Alignment.BASELINE)
													.addComponent(this.scoresTargetNumberDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE)
													.addComponent(this.scoresTargetCharDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE)).addContainerGap());
						}
						{
							this.participantContainer = new JPanel();
							GroupLayout participantContainerLayout = new GroupLayout(this.participantContainer);
							this.participantContainer.setLayout(participantContainerLayout);
							this.participantContainer.setBorder(BorderFactory.createTitledBorder(GuiComponentLabels.PARTICIPANTS));
							{
								this.scoresParticipantNameDropDown = new JComboBox();
								this.scoresParticipantNameDropDown.addActionListener(this.scoresActionListener);
							}
							{
								this.scoresParticipantClubLabel = new JLabel();
								this.scoresParticipantClubLabel.setText("verein");
							}
							{
								this.scoresParticipantBowCathegoryLabel = new JLabel();
								this.scoresParticipantBowCathegoryLabel.setText("bogenkategorie");
							}
							{
								this.scoresParticipantAgeClassLabel = new JLabel();
								this.scoresParticipantAgeClassLabel.setText("altersklasse");
							}
							participantContainerLayout.setHorizontalGroup(participantContainerLayout
									.createSequentialGroup()
									.addContainerGap()
									.addGroup(
											participantContainerLayout.createParallelGroup()
													.addComponent(this.getScoresParticipantNameDropDown(), GroupLayout.Alignment.LEADING, 0, 305, Short.MAX_VALUE)
													.addComponent(this.getScoresParticipantClubLabel(), GroupLayout.Alignment.LEADING, 0, 305, Short.MAX_VALUE)
													.addComponent(this.scoresParticipantBowCathegoryLabel, GroupLayout.Alignment.LEADING, 0, 305, Short.MAX_VALUE)
													.addComponent(this.scoresParticipantAgeClassLabel, GroupLayout.Alignment.LEADING, 0, 305, Short.MAX_VALUE)).addContainerGap());
							participantContainerLayout.setVerticalGroup(participantContainerLayout.createSequentialGroup().addContainerGap()
									.addComponent(this.getScoresParticipantNameDropDown(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
									.addComponent(this.getScoresParticipantClubLabel(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
									.addComponent(this.scoresParticipantBowCathegoryLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
									.addComponent(this.scoresParticipantAgeClassLabel, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE).addContainerGap(29, Short.MAX_VALUE));
						}
						{
							this.jScrollPane2 = new JScrollPane();
							{
								this.scoresTable = new TableWithOverwrite();
								this.scoresTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "selectNextColumnCell");
								this.jScrollPane2.setViewportView(this.scoresTable);
								this.scoresTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
								this.scoresTable.setDefaultRenderer(Object.class, new ScoresTableModelRenderer());
								this.scoresTable.addKeyListener(this.scoresKeyListener);
								this.scoresTable.addMouseListener(this.scoresMouseListener);
							}
						}
						{
							this.scoresTabOptionsWrapperPanel = new JPanel();
							GroupLayout scoresTabOptionsWrapperPanelLayout = new GroupLayout(this.scoresTabOptionsWrapperPanel);
							this.scoresTabOptionsWrapperPanel.setLayout(scoresTabOptionsWrapperPanelLayout);
							this.scoresTabOptionsWrapperPanel.setBorder(BorderFactory.createTitledBorder(GuiComponentLabels.OPTIONS));
							{
								this.saveAnyEntryCheckBox = new JCheckBox();
								this.saveAnyEntryCheckBox.setText("jede Eingabe sofort speichern");
								this.saveAnyEntryCheckBox.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent evt) {
										MainWindow.this.scoresController.setSaveImmediately(MainWindow.this.saveAnyEntryCheckBox.isSelected());
									}
								});
								this.saveAnyEntryCheckBox.setSelected(true);
								this.saveAnyEntryCheckBox.setToolTipText("deaktivierung verbessert die Geschwindigkeit");
							}
							scoresTabOptionsWrapperPanelLayout.setHorizontalGroup(scoresTabOptionsWrapperPanelLayout.createSequentialGroup().addContainerGap()
									.addComponent(this.saveAnyEntryCheckBox, 0, 390, Short.MAX_VALUE).addContainerGap());
							scoresTabOptionsWrapperPanelLayout.setVerticalGroup(scoresTabOptionsWrapperPanelLayout.createSequentialGroup().addContainerGap()
									.addComponent(this.saveAnyEntryCheckBox, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap(46, Short.MAX_VALUE));
						}
						scoresTabLayout.setHorizontalGroup(scoresTabLayout
								.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										scoresTabLayout.createParallelGroup()
												.addComponent(this.targetContainer, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 235, GroupLayout.PREFERRED_SIZE)
												.addComponent(this.participantContainer, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 235, GroupLayout.PREFERRED_SIZE))
								.addGap(12)
								.addGroup(
										scoresTabLayout
												.createParallelGroup()
												.addGroup(
														scoresTabLayout.createSequentialGroup().addComponent(this.scoresTabOptionsWrapperPanel, GroupLayout.PREFERRED_SIZE, 423,
																GroupLayout.PREFERRED_SIZE))
												.addGroup(scoresTabLayout.createSequentialGroup().addComponent(this.jScrollPane2, GroupLayout.PREFERRED_SIZE, 423, GroupLayout.PREFERRED_SIZE)))
								.addContainerGap(288, Short.MAX_VALUE));
						scoresTabLayout.setVerticalGroup(scoresTabLayout
								.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										scoresTabLayout
												.createParallelGroup()
												.addGroup(
														GroupLayout.Alignment.LEADING,
														scoresTabLayout.createSequentialGroup().addComponent(this.targetContainer, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
																.addComponent(this.participantContainer, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE))
												.addComponent(this.jScrollPane2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE))
								.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.scoresTabOptionsWrapperPanel, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE)
								.addContainerGap(315, Short.MAX_VALUE));
					}
					{
						this.rankingTab = new JPanel();
						GroupLayout finalsTabLayout = new GroupLayout(this.rankingTab);
						this.rankingTab.setLayout(finalsTabLayout);
						this.mainTabPane.addTab(GuiComponentLabels.RANKING, null, this.rankingTab, null);
						{
							this.rankingWrapperScrollPane = new JScrollPane();
							{
								this.rankingWrapper = new RankingPanel();
								this.rankingWrapperScrollPane.setViewportView(this.rankingWrapper);
								this.rankingWrapper.setBorder(BorderFactory.createTitledBorder(GuiComponentLabels.RANKING));
								this.rankingWrapper.setPreferredSize(new java.awt.Dimension(927, 639));
							}
						}
						finalsTabLayout.setHorizontalGroup(finalsTabLayout.createSequentialGroup().addContainerGap().addComponent(this.rankingWrapperScrollPane, 0, 946, Short.MAX_VALUE)
								.addContainerGap());
						finalsTabLayout.setVerticalGroup(finalsTabLayout.createSequentialGroup().addContainerGap()
								.addComponent(this.rankingWrapperScrollPane, GroupLayout.PREFERRED_SIZE, 642, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE));
					}
					{
						this.finalsTab = new JSplitPane();
						this.finalsTab.setOneTouchExpandable(true);
						this.finalsTab.setDividerLocation(200);
						this.mainTabPane.addTab(GuiComponentLabels.FINALS, null, this.finalsTab, null);
						{
							this.finalsChosingPanel = new JPanel();
							this.finalsTab.add(this.finalsChosingPanel, JSplitPane.LEFT);
							GroupLayout rightLayout = new GroupLayout(this.finalsChosingPanel);
							this.finalsChosingPanel.setLayout(rightLayout);
							this.finalsChosingPanel.setPreferredSize(new java.awt.Dimension(467, 664));
							{

								this.finalsBowCathegoryDropDown = new JComboBox();
								this.finalsBowCathegoryDropDown.addActionListener(this.finalsActionListener);

							}
							{
								this.jScrollPane3 = new JScrollPane();
								{
									this.finalsParticipantsTable = new JTable();
									this.finalsParticipantsTable.setDefaultRenderer(Object.class, new FinalsTableModelRenderer());
									this.jScrollPane3.setViewportView(this.finalsParticipantsTable);
								}
							}
							{
								this.startFinalForBowCathegoryButton = new JButton();
								this.startFinalForBowCathegoryButton.setText(GuiComponentLabels.START_FINALS_BUTTON);
							}
							rightLayout.setHorizontalGroup(rightLayout
									.createSequentialGroup()
									.addContainerGap()
									.addGroup(
											rightLayout.createParallelGroup().addComponent(this.finalsBowCathegoryDropDown, GroupLayout.Alignment.LEADING, 0, 443, Short.MAX_VALUE)
													.addComponent(this.jScrollPane3, GroupLayout.Alignment.LEADING, 0, 443, Short.MAX_VALUE)
													.addComponent(this.startFinalForBowCathegoryButton, GroupLayout.Alignment.LEADING, 0, 444, Short.MAX_VALUE)).addContainerGap());
							rightLayout.setVerticalGroup(rightLayout.createSequentialGroup().addContainerGap()
									.addComponent(this.finalsBowCathegoryDropDown, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.jScrollPane3, GroupLayout.PREFERRED_SIZE, 557, GroupLayout.PREFERRED_SIZE)
									.addGap(0, 28, Short.MAX_VALUE).addComponent(this.startFinalForBowCathegoryButton, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE).addContainerGap());
						}
						{
							this.koPanel = new JPanel();
							GroupLayout koPanelLayout = new GroupLayout(this.koPanel);
							this.koPanel.setLayout(koPanelLayout);
							this.graph = new mxGraph();
							this.graphComponent = new mxGraphComponent(this.graph);
							this.finalsTab.add(this.koPanel, JSplitPane.RIGHT);
							koPanelLayout.setHorizontalGroup(koPanelLayout.createSequentialGroup().addContainerGap().addComponent(this.graphComponent, 0, 194, Short.MAX_VALUE).addContainerGap());
							koPanelLayout.setVerticalGroup(koPanelLayout.createSequentialGroup().addContainerGap().addComponent(this.graphComponent, 0, 640, Short.MAX_VALUE).addContainerGap());
							this.graphComponent.getGraphControl().addMouseListener(this.finalsMouseListener);
						}
					}
				}
			}
			{
				this.menuBar = new JMenuBar();
				this.setJMenuBar(this.menuBar);
				{
					this.dataMenu = new JMenu();
					this.menuBar.add(this.dataMenu);
					this.dataMenu.setText(GuiComponentLabels.DATA_MENU);
					{
						this.newTournamentMenuItem = new JMenuItem();
						this.dataMenu.add(this.newTournamentMenuItem);
						this.newTournamentMenuItem.setText(GuiComponentLabels.NEW_TOURNAMENT);
						this.newTournamentMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.createNewTournament();
							}
						});
					}
					{
						this.openMenuItem = new JMenuItem();
						this.dataMenu.add(this.openMenuItem);
						this.openMenuItem.setText(GuiComponentLabels.OPEN);
						this.openMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.openFile();
							}
						});
					}
					{
						this.saveItem = new JMenuItem();
						this.dataMenu.add(this.saveItem);
						this.saveItem.setText(GuiComponentLabels.SAVE_BUTTON);
						this.saveItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.saveTournamentData();
							}
						});
					}
					{
						this.addPlayerMenuIten = new JMenuItem();
						this.dataMenu.add(this.addPlayerMenuIten);
						this.addPlayerMenuIten.setText(GuiComponentLabels.ADD_ARCHER);
						this.addPlayerMenuIten.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.addArcher();
							}
						});
					}
					{
						this.importMenu = new JMenu();
						this.dataMenu.add(this.importMenu);
						this.importMenu.setText(GuiComponentLabels.IMPORT);
						{
							this.importFromCsvMenuItem = new JMenuItem();
							this.importMenu.add(this.importFromCsvMenuItem);
							this.importFromCsvMenuItem.setText(GuiComponentLabels.FROM_CSV);
							this.importFromCsvMenuItem.addActionListener(new ActionListener() {
								public void actionPerformed(ActionEvent evt) {
									MainWindow.this.controller.importFromFile();
								}
							});
						}
					}
					{
						this.CloseMenuItem = new JMenuItem();
						this.dataMenu.add(this.CloseMenuItem);
						this.CloseMenuItem.setText(GuiComponentLabels.CLOSE_MENU_ITEM);
						this.CloseMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.closeOperation();
							}
						});
					}
				}
				{
					this.editMenu = new JMenu();
					this.menuBar.add(this.editMenu);
					this.editMenu.setText(GuiComponentLabels.EDIT_MENU);
					{
						this.archerEditingMenuItem = new JMenuItem();
						this.editMenu.add(this.archerEditingMenuItem);
						this.archerEditingMenuItem.setText(GuiComponentLabels.ARCHERS);
						this.archerEditingMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.openDbEditor();
							}
						});
					}
				}
				{
					this.optionsMenu = new JMenu();
					this.menuBar.add(this.optionsMenu);
					this.optionsMenu.setText(GuiComponentLabels.OPTIONS_MENU);
					{
						this.colorCustomizingMenuItem = new JMenuItem();
						this.optionsMenu.add(this.colorCustomizingMenuItem);
						this.colorCustomizingMenuItem.setText(GuiComponentLabels.COLOR_CUSTOMIZING);
						this.colorCustomizingMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.openColorCustomization();
							}
						});
					}
					{
						this.customizeTournamentItem = new JMenuItem();
						this.optionsMenu.add(this.customizeTournamentItem);
						this.customizeTournamentItem.setText(GuiComponentLabels.TOURNAMENT_CUSTOMIZING);
						this.customizeTournamentItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								MainWindow.this.controller.openDistancesEditorWindow();
							}
						});
					}
					{
						this.finalsPermissionMenuItem = new JMenuItem();
						this.optionsMenu.add(this.finalsPermissionMenuItem);
						this.finalsPermissionMenuItem.setText(GuiComponentLabels.FINALS_PERMISSION);
						this.finalsPermissionMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								SwingUtilities.invokeLater(new Runnable() {
									public void run() {
										FinalsOptionsWindow.getInstance().setLocationRelativeTo(null);
										FinalsOptionsWindow.getInstance().setVisible(true);
										FinalsOptionsWindow.getInstance().getController().buildTable();
									}
								});
							}
						});
					}
				}
				{
					this.printMenu = new JMenu();
					this.menuBar.add(this.printMenu);
					this.printMenu.setText(GuiComponentLabels.PRINT_MENU);
					{
						this.printParticipantsMenuItem = new JMenuItem();
						this.printMenu.add(this.printParticipantsMenuItem);
						this.printParticipantsMenuItem.setText(GuiComponentLabels.PRINT_PARTICIPANTS);
						this.printParticipantsMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								new Printer(MainWindow.this.participantsTable, GuiComponentLabels.PARTICIPANTS);
							}
						});
					}
					{
						this.printTargetAssignentMenuItem = new JMenuItem();
						this.printMenu.add(this.printTargetAssignentMenuItem);
						this.printTargetAssignentMenuItem.setText(GuiComponentLabels.TARGET_ASSIGNMENT);
						this.printTargetAssignentMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								new Printer(MainWindow.this.targetAssignmentTable, GuiComponentLabels.TARGET_ASSIGNMENT);
							}
						});
					}
					{
						this.printRankingMenuItem = new JMenuItem();
						this.printMenu.add(this.printRankingMenuItem);
						this.printRankingMenuItem.setText(GuiComponentLabels.RANKING);
						this.printRankingMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								new Printer(MainWindow.this.getRankingTables(), "subtitle");
								// TODO printjob!
								/*
								 * // possibly prepare the table for printing
								 * here // first // wrap in a try/finally so
								 * table can be // restored even if something //
								 * fails try { PrinterJob job =
								 * PrinterJob.getPrinterJob();// fetch // a //
								 * PrinterJob
								 * job.setPrintable(MainWindow.this.rankingWrapper
								 * );// set // the // Printable // on // the //
								 * PrinterJob // create an attribute set to
								 * store // attributes from the print dialog
								 * PrintRequestAttributeSet attr = new
								 * HashPrintRequestAttributeSet(); // display a
								 * print dialog and record whether // or not the
								 * user cancels // it boolean printAccepted =
								 * job.printDialog(attr); if (printAccepted) {//
								 * if the user didn't // cancel the dialog
								 * System.out.println("before job.print");
								 * job.print(attr);// do the printing
								 * System.out.println("after job.print()"); } }
								 * catch (PrinterException e) { // TODO
								 * Auto-generated catch block
								 * e.printStackTrace(); } finally { // possibly
								 * restore the original table state // here }
								 */

							}
						});
					}
				}
			}
			this.pack();
			this.setSize(1000, 750);
		} catch (Exception e) {
			// add your error handling code here
			e.printStackTrace();
		}
	}

	private void setColumnwidths2(JTable table) {
		int pixelperchar = 10;
		/* ID */
		table.getColumnModel().getColumn(0).setPreferredWidth(pixelperchar * 3);
		/* Platz */
		table.getColumnModel().getColumn(1).setPreferredWidth(pixelperchar * 6);
	}

	private void setColumnwidths(JTable table) {

		int pixelperchar = 10;
		/* ID */
		table.getColumnModel().getColumn(0).setPreferredWidth(pixelperchar * 3);
		/* Name */
		// table.getColumnModel().getColumn(1).setPreferredWidth(pixelperchar *
		// 10);
		/* Vorname */
		// table.getColumnModel().getColumn(2).setPreferredWidth(pixelperchar *
		// 10);
		/* Nation */
		// table.getColumnModel().getColumn(3).setPreferredWidth(pixelperchar *
		// 12);
		/* Bundesland */
		// table.getColumnModel().getColumn(4).setPreferredWidth(pixelperchar *
		// 12);
		/* Bogenkategorie */
		// table.getColumnModel().getColumn(5).setPreferredWidth(pixelperchar *
		// 12);
		/* Altersklasse */
		// table.getColumnModel().getColumn(6).setPreferredWidth(pixelperchar *
		// 12);
		/* Verein */
		table.getColumnModel().getColumn(7).setPreferredWidth(pixelperchar * 15);
		/* Geschlecht */
		// table.getColumnModel().getColumn(8).setPreferredWidth(pixelperchar *
		// 6);
		/* Lizenz */
		table.getColumnModel().getColumn(9).setPreferredWidth(pixelperchar * 6);
		/* Landeswertung */
		table.getColumnModel().getColumn(10).setPreferredWidth(pixelperchar * 6);
		/* Geburtstag */
		// table.getColumnModel().getColumn(11).setPreferredWidth(pixelperchar *
		// 12);
	}

	public JTable getNonParticipantsTable() {
		return this.nonParticipantsTable;
	}

	public JTextField getRefereeTextBox() {
		return this.refereeTextBox;
	}

	public JTextField getTournamentLeadTextBox() {
		return this.tournamentLeadTextBox;
	}

	public JTextField getOrganizerTextBox() {
		return this.organizerTextBox;
	}

	public JTextField getEndDateTextBox() {
		return this.endDateTextBox;
	}

	public JTextField getStartDateTextBox() {
		return this.startDateTextBox;
	}

	public JComboBox getTournamentTypeDropDown() {
		return this.tournamentTypeDropDown;
	}

	public JTextField getTournamentNameTextBox() {
		return this.tournamentNameTextBox;
	}

	public JSplitPane getPlayerAssignmentTab() {
		return this.playerAssignmentTab;
	}

	public MainWindowController getController() {
		return this.controller;
	}

	public File getFile() {
		return this.file;
	}

	public JTable getParticipantsTable() {
		return this.participantsTable;
	}

	public JLabel getNumberOfTargetsLabel() {
		return this.numberOfTargetsLabel;
	}

	public JLabel getPlayersPerTargetLabel() {
		return this.playersPerTargetLabel;
	}

	public JComboBox getTargetNumberDropDown() {
		return this.targetNumberDropDown;
	}

	public JComboBox getTargetCharDropDown() {
		return this.targetCharDropDown;
	}

	public JTable getTargetAssignmentTable() {
		return this.targetAssignmentTable;
	}

	public TargetAssignmentController getTargetAssignmentController() {
		return this.targetAssignmentController;
	}

	public JComboBox getScoresParticipantNameDropDown() {
		return this.scoresParticipantNameDropDown;
	}

	public JLabel getScoresParticipantBowCathegoryLabel() {
		return this.scoresParticipantBowCathegoryLabel;
	}

	public JLabel getScoresParticipantAgeClassLabel() {
		return this.scoresParticipantAgeClassLabel;
	}

	public JLabel getScoresParticipantClubLabel() {
		return this.scoresParticipantClubLabel;
	}

	public JComboBox getScoresTargetNumberDropDown() {
		return this.scoresTargetNumberDropDown;
	}

	public JComboBox getScoresTargetCharDropDown() {
		return this.scoresTargetCharDropDown;
	}

	public ScoresController getScoresController() {
		return this.scoresController;
	}

	public JTable getScoresTable() {
		return this.scoresTable;
	}

	public JPanel getRankingTab() {
		return this.rankingTab;
	}

	public void setRankingWrapper(RankingPanel panel) {
		this.rankingWrapper = panel;
	}

	public JPanel getRankingWrapper() {
		return this.rankingWrapper;
	}

	public JScrollPane getRankingWrapperScrollPane() {
		return this.rankingWrapperScrollPane;
	}

	public void setRankingPanels(ArrayList < JPanel > rankingPanels) {
		this.rankingPanels = rankingPanels;

	}

	public ArrayList < JPanel > getRankingPanels() {
		return this.rankingPanels;
	}

	public void setRankingTables(ArrayList < RankingTable > rankingTables) {
		this.rankingTables = rankingTables;

	}

	public ArrayList < RankingTable > getRankingTables() {
		return this.rankingTables;
	}

	public JComboBox getFinalsBowCathegoryDropDown() {
		return this.finalsBowCathegoryDropDown;
	}

	public JTable getFinalsParticipantsTable() {
		return this.finalsParticipantsTable;
	}

	public FinalsController getFinalsController() {
		return this.finalsController;
	}

	public mxGraph getGraph() {
		return this.graph;
	}

	public mxGraphComponent getGraphComponent() {
		return this.graphComponent;
	}

	public JTable getStatisticsTable() {
		return this.statisticsTable;
	}
}